//
//  ChainSearchHistoryFooterView.m
//  Chain
//
//  Created by zhaosh on 2018/4/4.
//  Copyright © 2018年 zhaosh. All rights reserved.
//

#import "ChainSearchHistoryFooterView.h"
@interface ChainSearchHistoryFooterView()
@property(strong,nonatomic)UIButton *clearBtn;

@end

@implementation ChainSearchHistoryFooterView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor clearColor];
        [self setupSubviews];
    }
    return self;
}

-(void)setupSubviews{
    self.clearBtn = [[UIButton alloc]initWithFrame:CGRectMake((self.width - 105.5)/2, 40, 105.5, 30)];
    self.clearBtn.backgroundColor = HEXCOLOR(@"#ffffff");
    self.clearBtn.layer.cornerRadius = 2;
    self.clearBtn.layer.masksToBounds = YES;
    [self.clearBtn setTitleColor:HEXCOLOR(@"#666666") forState:UIControlStateNormal];
    self.clearBtn.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.clearBtn setTitle:@"清空搜索记录" forState:UIControlStateNormal];
    [self addSubview:self.clearBtn];
    [self.clearBtn addTarget:self action:@selector(clearBtnClicked) forControlEvents:UIControlEventTouchUpInside];
}

-(void)clearBtnClicked{
    if ([self.delegate respondsToSelector:@selector(footerVClearBtnClicked)]) {
        [self.delegate footerVClearBtnClicked];
    }
}
@end
